package com.lemobar.pay.model.alipay.response;

import lombok.Data;

import java.util.Date;

/**
 * 付款码支付 响应
 * alipay.trade.pay
 * https://opendocs.alipay.com/open/02ekfp?scene=32
 */
@Data
public class AliPayTradePayResponse {
    /* 响应实例
    {
        "alipay_trade_pay_response": {
            "code": "10000",
            "msg": "Success",
            "trade_no": "2013112011001004330000121536",
            "out_trade_no": "6823789339978248",
            "buyer_logon_id": "159****5620",
            "total_amount": 120.88,
            "receipt_amount": "88.88",
            "buyer_pay_amount": 8.88,
            "point_amount": 8.12,
            "invoice_amount": 12.5,
            "gmt_payment": "2014-11-27 15:45:57",
            "fund_bill_list": [
                {
                    "fund_channel": "ALIPAYACCOUNT",
                    "amount": 10,
                    "real_amount": 11.21
                }
            ],
            "store_name": "证大五道口店",
            "buyer_user_id": "2088101117955611",
            "discount_goods_detail": "[{\"goods_id\":\"STANDARD1026181538\",\"goods_name\":\"雪碧\",\"discount_amount\":\"100.00\",\"voucher_id\":\"2015102600073002039000002D5O\"}]",
            "voucher_detail_list": [
                {
                    "id": "2015102600073002039000002D5O",
                    "name": "XX超市5折优惠",
                    "type": "ALIPAY_FIX_VOUCHER",
                    "amount": 10,
                    "merchant_contribute": 9,
                    "other_contribute": 1,
                    "memo": "学生专用优惠",
                    "template_id": "20171030000730015359000EMZP0",
                    "purchase_buyer_contribute": 2.01,
                    "purchase_merchant_contribute": 1.03,
                    "purchase_ant_contribute": 0.82
                }
            ],
            "mdiscount_amount": "88.88",
            "discount_amount": "88.88"
        },
        "sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
    }
     */

    private AliPayTradePayResponse.Content alipayTradePayResponse;

    /**
     * 签名,详见文档  https://doc.open.alipay.com/docs/doc.htm?treeId=291&articleId=106074&docType=1
     */
    private String sign;

    @Data
    public static class Content{

        private String code;
        private String msg;
        private String subCode;
        private String subMsg;

        /**
         * 支付宝交易号
         */
        private String tradeNo;
        /**
         * 商户订单号
         */
        private String outTradeNo;
        /**
         * 买家支付宝账号
         */
        private String buyerLogonId;
        /**
         * 交易金额
         */
        private Double totalAmount;
        /**
         * 实收金额
         */
        private String receiptAmount;
        /**
         * 买家付款的金额
         */
        private Double buyerPayAmount;
        /**
         * 使用集分宝付款的金额
         */
        private Double pointAmount;
        /**
         * 交易中可给用户开具发票的金额
         */
        private Double invoiceAmount;
        /**
         * 交易支付时间
         */
        private Date gmtPayment;

        /**
         * 交易支付使用的资金渠道。
         * 只有在签约中指定需要返回资金明细，或者入参的query_options中指定时才返回该字段信息。
         */
        //private TradeFundBill[] fundBillList;

        /**
         * 发生支付交易的商户门店名称
         */
        private String storeName;
        /**
         * 买家在支付宝的用户id
         */
        private String buyerUserId;
        /**
         * 本次交易支付所使用的单品券优惠的商品优惠信息。
         * 只有在query_options中指定时才返回该字段信息。
         */
        private String discountGoodsDetail;

        /**
         * 本交易支付时使用的所有优惠券信息。
         * 只有在query_options中指定时才返回该字段信息。
         */
        //private VoucherDetail[] voucherDetailList;


        /**
         * 商家优惠金额
         */
        private String mdiscountAmount;
        /**
         * 平台优惠金额
         */
        private String discountAmount;
    }

}
